
#include "graphics.h"
#include "stdio.h"
#include "g:\c\include\rand.h"
#include "g:\c\include\globe.h"
/*-------------------------------------------*/ 
#include "g:\c\include\rain.h"
#include "g:\c\include\rains.h"
#include "g:\c\include\change.h"
/*-------------------------------------------*/ 
#include "g:\c\include\rain.c"
#include "g:\c\include\rains.c"
#include "g:\c\include\change.c"
/*-------------------------------------------*/ 
void save() 
{ 
FILE *fp; 
fp=fopen("rain.sv","w"); 
fprintf(fp,"%lf %lf %d",hangle,dHAngle,isplaneon); 
fclose(fp); 
} 
void load() 
{ 
FILE *fp; 
fp=fopen("rain.sv","r"); 
fscanf(fp,"%lf %lf %d",&hangle,&dHAngle,&isplaneon); 
fclose(fp); 
} 


void main() 
{ 
int gd=DETECT,gm; 
Rains rains;
registerbgidriver(EGAVGA_driver);
initgraph(&gd,&gm,""); 
initrand(); 
load(); 
SetPlane(-500,-500,500,500); 
{ 
int n; 
InitRains(&rains); 
for(n=0;n<23;n++) 
{ 
AddRain(&rains); 
rains.current->nextone->dh=-23; 
rains.current->nextone->dx=-2.5; 
rains.current->nextone->dy=3; 
} 
} 
{ 
char c=0; 
double n=0; 
int i,true=1; 
setcolor(5); 
while(true) 
{ 
AddHAngle(); 
/*printf("%lf,%lf\r",hangle,dHAngle); 
delay(50);*/ 
for(i=0;i<rains.NumOfRains;i++) 
{ 
Draw(rains.current); 
rains.current=rains.current->nextone; 
} 
if(isplaneon) 
{ 
setcolor(0); 
RidHAngle(); 
DrawDefaultPlane(0); 
setcolor(9); 
AddHAngle(); 
DrawDefaultPlane(0); 
} 
if(kbhit()) 
{ 
char c; 
c=getch(); 
switch(c) 
{ 
case 'p': 
if(isplaneon) 
{ 
setcolor(0); 
DrawDefaultPlane(0); 
} 
isplaneon=!isplaneon; 
break; 
case '-': 
dHAngle-=0.5; 
break; 
case '=':dHAngle+=0.5; 
break; 
default:true=0; 
break; 
} 
} 
} 
} 
closegraph(); 
DestroyRains(&rains); 
save(); 
} 
